package com.yxq.mdt.app.modules.personal.presenter;

import com.yxq.mdt.app.base.BasePresenter;
import com.yxq.mdt.app.base.RespBase;
import com.yxq.mdt.app.modules.personal.bean.RechargeListBean;
import com.yxq.mdt.app.modules.personal.bean.RechargePayResultBean;
import com.yxq.mdt.app.modules.personal.bean.RechargeWxPayResultBean;
import com.yxq.mdt.app.modules.personal.model.RechargeModel;
import com.yxq.mdt.app.modules.personal.model.SettingModel;
import com.yxq.mdt.app.modules.withdraw.bean.WithDrawResultBean;
import com.yxq.mdt.app.net.ApiModel;

public class RechargePresenter extends BasePresenter<IRechargeContract.View, RechargeModel> implements IRechargeContract.Presenter {

    public RechargePresenter(IRechargeContract.View rootView, RechargeModel model) {
        super(rootView, model);
    }

    @Override
    public void selectPageInfoAndroid(int pageNum, int pageSize) {
        mBaseModel.selectPageInfoAndroid(pageNum, pageSize, new ApiModel.CommonCallback<RechargeListBean>() {
            @Override
            public void onSuccess(RechargeListBean data) {
                mRootView.onLoadSuccess(data);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onLoadFailed(errMsg);
            }
        });
    }

    public void recharge(long money, int platform, int sugarId) {
        mBaseModel.recharge(money, platform, sugarId, new ApiModel.CommonCallback<RechargePayResultBean>() {
            @Override
            public void onSuccess(RechargePayResultBean data) {
                mRootView.onRechargeSuccess(data);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onRechargeFailed(errMsg);
            }
        });
    }

    public void wxPay(int orderId) {
        mBaseModel.wxPay(orderId, new ApiModel.CommonCallback<RechargeWxPayResultBean>() {
            @Override
            public void onSuccess(RechargeWxPayResultBean data) {
                mRootView.onRechargeWxSuccess(data);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onRechargeWxFailed(errMsg);
            }
        });
    }

    public void cashdrill(String honey_drill, int platform, int type, String mobile, String name, String bank_no, String bank_name,String contactPhone) {
        mBaseModel.cashdrill(honey_drill, platform, type, mobile, name, bank_no, bank_name,contactPhone, new ApiModel.CommonCallback<WithDrawResultBean>() {
            @Override
            public void onSuccess(WithDrawResultBean data) {
                mRootView.onCashdrillSuccess(data);
            }

            @Override
            public void onError(String errMsg) {
                mRootView.onCashdrillFailed(errMsg);
            }
        });
    }

}
